<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<link rel="stylesheet" href="front/css/normal.css">
        <link rel="stylesheet" href="front/css/addBox.css">
        	<!-- 日历插件 -->
		<link rel="stylesheet" href="front/css/bootstrap-datetimepicker.css"  type="text/css" >
		<!-- 省市关联 -->
	   <script src="http://www.jq22.com/jquery/1.11.1/jquery.min.js"></script>
	   <script src="http://www.jq22.com/jquery/bootstrap-3.3.4.js"></script>
	   <script src="static/provice/distpicker.data.js"></script>
	   <script src="static/provice/distpicker.js"></script>
	   <script src="static/provice/main.js"></script>
	</head>
<body>
  <p class="addSlide-title">添加分公司<span>×</span></p>
	<form action="boadd/${msg}.do"  enctype="multipart/form-data" name="Form" id="Form" method="post">
		<ul class="addList">
	 	        <li><input type="hidden" name="chat_id" id="chat_id" value="${chat_id}"/></li>
		        <li><input type="hidden" name="filiale_apply_id" id="filiale_apply_id" value="${pd.filiale_apply_id}"/></li>
				<li><span>分公司名称:</span><input type="text" name="filiale_name" id="filiale_name" value="${pd.filiale_apply_name}" maxlength="32" placeholder="分公司名称" title=""/></li>
			     <li><span>申请人:</span><input type="text" name="filiale_apply_applicant" id="filiale_apply_applicant" value="${pd.filiale_apply_applicant}" maxlength="32" placeholder="申请人" title=""/></li>
			     <li><span>准备开展业务:</span><input type="hidden" id="preparing_for_business"  name="preparing_for_business" value=""/>
			        <input type='checkbox'  name="pfbo"  id="pfb1"  value="监理"   /><label class="lbl" for="pfb1" >监理</label>&nbsp;&nbsp;
				    <input type='checkbox'  name='pfbo'  id="pfb2"  value="造价咨询"   /><label class="lbl" for="pfb2">造价咨询</label>&nbsp;&nbsp;
				    <input type='checkbox'  name='pfbo'  id="pfb3"  value="招标代理"  /><label class="lbl" for="pfb3">招标代理</label>&nbsp;&nbsp;
                  </li>		
                  <li><span>经营保证金:</span><input type="text" name="filiale_operating_margin" id="filiale_operating_margin" maxlength="13" value="${pd.filiale_apply_operating_margin }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" placeholder="经营保证金" />元</li>		                                                                                                                         
				  <li><span>详细地址:</span><input type="text" name="region" id="region" value="${pd.region}" maxlength="32" placeholder="这里输入" title=""/></li>
				  <li><span>预算管理费:</span><input type="text" value="${var.filiale_apply_management_expense }" readonly="readonly" maxlength="13" name="filiale_management_expense" id="filiale_management_expense" onkeyup="this.value=this.value.replace(/\D/g,'')"  placeholder="预算管理费" />&nbsp;&nbsp;元:￥</li>
				  	<li><span>合同到期时间:</span><input type="text" name="expire" id="expire" class="form_datetime date"  maxlength="32" placeholder="年-月-日" title=""/></li>
				  <li><span>公司协议附件:</span>
                          <a class="file operatea upload">
					            点击上传文件
			            	<input type="file" name="file">
			            	<span></span>
			        	</a>
                  </li>
				  <li><span>劳动合同:</span>
                          <a class="file operatea upload">
					            点击上传文件
			            	<input type="file" name="file">
			            	<span></span>
			        	</a>
                 </li>
				  </ul>
				 	<p>
					    <input class="cancelSave" onclick="cancel();" value="取消保存"/>
						<input class="confirmSave" onclick="save();" value="确认保存"/>
				  </p>
	</form>
	   <script src="front/js/jquery-2.0.3.min.js"></script>
	   <script src="front/js/index.js"></script>
	   <script type="text/javascript" src="front/js/jquery.tips.js"></script>
	   <!-- 日历插件 -->
	    <script src="front/js/bootstrap-datetimepicker.js"></script>
		<script type="text/javascript">
		function cancel(){
			$('#zhongxin', parent.document).hide();
		}
	      $(function() {
				$(".form_datetime").datetimepicker( {
	                autoclose:true,
	                format: "yyyy-mm-dd hh:ii",
	                language: 'cn',
	                clearBtn:true,
	                todayHighlight: true
	            });
	        });
		$(function() {
			$("input[name='pfbo']").change(function(){
				var checks = $("input[name='pfbo']:checked");
				if(checks.length > 2){
					$("#filiale_management_expense").val("20");
				}else if(checks.length == 0){
					$("#filiale_management_expense").val("0");
				}else{
					$("#filiale_management_expense").val("15");
				}
			});
		}); 
		//手机号验证
		function	phoneNum(){
			var phone = document.getElementById("introducer_phone").value;	
			if(phone && /^1[3|4|5|8]\d{9}$/.test(phone)){
			} else{
				document.getElementById("introducer_phone").value='';
				$("#introducer_phone").tips({
					side:3,
		            msg:'请输入正确的手机号',
		            bg:'#AE81FF',
		            time:1
				});
			}
			}
		//保存
		function save(){
						if($("#filiale_operating_margin").val()==""){
								$("#filiale_operating_margin").tips({
									side:3,
						            msg:'请输入',
						            bg:'#AE81FF',
						            time:2
						        });
								$("#filiale_operating_margin").focus();
								return false;
							}
			        var chenked=$("input[name='pfbo']:checked").val([]);
			    		    var name="";
			    		    for(var i=0;i<chenked.length;i++){
			    		    	if(i==(chenked.length-1)){   
			    		    		name+=chenked[i].value;
			    		    	}else{
			    		    	name+=chenked[i].value +",";
			    		    	}
			    		    }
			    		 document.getElementById("preparing_for_business").value=name;
					$("#Form").submit();
					$("#zhongxin").hide();
					$("#zhongxin2").show();
		}
		//复选框拼接
	function loadMap(){
			 // 百度地图API功能  
    var map = new BMap.Map("allmap");//创建百度地图实例，这里的allmap是地图容器的id  
    var point = new BMap.Point(116.721713, 39.774855);//创建一个点对象，这里的参数是地图上的经纬度  
    map.centerAndZoom(point, 20);//这里是将地图的中心移动到我们刚才创建的点；这里的12是地图的缩放界别；数值越大，地图看的越细  
	map.addControl(new BMap.MapTypeControl());//添加图像控件
	map.setCurrentCity("西安");
	map.enableScrollWheelZoom(true);
    var marker=new BMap.Marker(point);
    map.addOverlay(marker);
    marker.enableDragging();    
    marker.addEventListener("dragend", function(e){    
     alert("当前位置：" + e.point.lng + ", " + e.point.lat);    
    })
		}
		</script>
</body>
</html>